package bird.compose;

/**
 * @author hanjian
 */
public class CDuck implements Callable, Egglayable, Flyable {
    /**
     * 叫 组合
     */
    private CallAbility callAbility = new CallAbility();
    /**
     * 下蛋 组合
     */
    private EggAbility eggAbility = new EggAbility();
    /**
     * 飞 组合
     */
    private FlyAbility flyAbility = new FlyAbility();

    @Override
    public void call() {
        /**
         * 委托
         */
        this.callAbility.call();
    }

    @Override
    public void egg() {
        /**
         * 委托
         */
        this.eggAbility.egg();
    }

    @Override
    public void fly() {
        /**
         * 委托
         */
        this.flyAbility.fly();
    }

    /**
     * 游泳
     */
    public void swimming() {
        System.out.println("Duck swimming!");
    }
}
